// Adapted translation of https""://github.com/Kurento/kms-core/blob/master/src/server/interface/KurentoException.hpp

const C = require('../../constants/constants');

module.exports = {
  /* GENERIC MEDIA ERRORS */
  40001:  { type: "MARSHALL_ERROR", error: C.ERROR.MEDIA_SERVER_GENERIC_ERROR },
  40003:  { type: "UNEXPECTED_ERROR", error: C.ERROR.MEDIA_SERVER_GENERIC_ERROR },
  40004:  { type: "CONNECT_ERROR", error: C.ERROR.MEDIA_CONNECT_ERROR },
  40005:  { type: "UNSUPPORTED_MEDIA_TYPE",  error: C.ERROR.MEDIA_INVALID_TYPE },
  40006:  { type: "NOT_IMPLEMENTED" , error: C.ERROR.MEDIA_INVALID_OPERATION },
  40007:  { type: "INVALID_SESSION", error: C.ERROR.CONNECTION_ERROR },
  40008:  { type: "MALFORMED_TRANSACTION", error: C.ERROR.MEDIA_INVALID_OPERATION },
  40009:  { type: "NOT_ENOUGH_RESOURCES", error: C.ERROR.MEDIA_SERVER_NO_RESOURCES },

  /* MediaObject ERRORS */
  40100:  { type: "MEDIA_OBJECT_TYPE_NOT_FOUND", error: C.ERROR.MEDIA_INVALID_TYPE },
  40101:  { type: "MEDIA_OBJECT_NOT_FOUND", error: C.ERROR.MEDIA_NOT_FOUND },
  40104:  { type: "MEDIA_OBJECT_CONSTRUCTOR_NOT_FOUND", error: C.ERROR.MEDIA_INVALID_OPERATION },
  40105:  { type: "MEDIA_OBJECT_METHOD_NOT_FOUND", error: C.ERROR.MEDIA_INVALID_OPERATION },
  40106:  { type: "MEDIA_OBJECT_EVENT_NOT_SUPPORTED", error: C.ERROR.MEDIA_INVALID_OPERATION },
  40107:  { type: "MEDIA_OBJECT_ILLEGAL_PARAM_ERROR", error: C.ERROR.MEDIA_INVALID_OPERATION },
  40108:  { type: "MEDIA_OBJECT_NOT_AVAILABLE", error: C.ERROR.MEDIA_NOT_FOUND },
  40109:  { type: "MEDIA_OBJECT_NOT_FOUND_TRANSACTION_NO_COMMIT", error: C.ERROR.MEDIA_INVALID_OPERATION },
  40110:  { type: "MEDIA_OBJECT_TAG_KEY_NOT_FOUND", error: C.ERROR.MEDIA_INVALID_OPERATION },
  40111:  { type: "MEDIA_OBJECT_OPERATION_NOT_SUPPORTED", error: C.ERROR.MEDIA_INVALID_OPERATION },

  /* SDP ERRORS */
  40200:  { type: "SDP_CREATE_ERROR", error: C.ERROR.MEDIA_GENERIC_ERROR },
  40201:  { type: "SDP_PARSE_ERROR", error: C.ERROR.MEDIA_INVALID_SDP },
  40202:  { type: "SDP_END_POINT_NO_LOCAL_SDP_ERROR", error: C.ERROR.MEDIA_INVALID_SDP },
  40203:  { type: "SDP_END_POINT_NO_REMOTE_SDP_ERROR", error: C.ERROR.MEDIA_INVALID_SDP },
  40204:  { type: "SDP_END_POINT_GENERATE_OFFER_ERROR", error: C.ERROR.MEDIA_GENERATE_OFFER_FAILED },
  40205:  { type: "SDP_END_POINT_PROCESS_OFFER_ERROR" , error: C.ERROR.MEDIA_PROCESS_OFFER_FAILED },
  40206:  { type: "SDP_END_POINT_PROCESS_ANSWER_ERROR", error: C.ERROR.MEDIA_PROCESS_ANSWER_FAILED },
  40207:  { type: "SDP_CONFIGURATION_ERROR", error: C.ERROR.MEDIA_GENERIC_ERROR },
  40208:  { type: "SDP_END_POINT_ALREADY_NEGOTIATED", error: C.ERROR.MEDIA_PROCESS_OFFER_FAILED },
  40209:  { type: "SDP_END_POINT_NOT_OFFER_GENERATED", error: C.ERROR.MEDIA_GENERATE_OFFER_FAILED },
  40210:  { type: "SDP_END_POINT_ANSWER_ALREADY_PROCCESED", error: C.ERROR.MEDIA_PROCESS_ANSWER_FAILED },
  40211:  { type: "SDP_END_POINT_CANNOT_CREATE_SESSON", error: C.ERROR.MEDIA_GENERIC_ERROR },

  /* HTTP ERRORS */
  40300:  { type: "HTTP_END_POINT_REGISTRATION_ERROR" },

  /* ICE ERRORS */
  40400:  { type: "ICE_GATHER_CANDIDATES_ERROR", error: C.ERROR.ICE_GATHERING_FAILED },
  40401:  { type: "ICE_ADD_CANDIDATE_ERROR", error: C.ERROR.ICE_CANDIDATE_FAILED },

  /* SERVER MANAGER ERRORS */
  40500:  { type: "SERVER_MANAGER_ERROR_KMD_NOT_FOUND", error: C.ERROR.MEDIA_SERVER_GENERIC_ERROR },

  /* URI ERRORS */
  40600:  { type: "URI_ERROR_MIN" },
  40699:  { type: "URI_ERROR_MAX" },
  40600:  { type: "URI_PATH_FILE_NOT_FOUND", error: C.ERROR.MEDIA_INVALID_OPERATION },

  /* PLAYER ERRORS */
  40700:  { type: "PLAYER_ERROR_MIN" },
  40799:  { type: "PLAYER_ERROR_MAX" },
  40700:  { type: "PLAYER_SEEK_FAIL", error: C.ERROR.MEDIA_GENERIC_ERROR },
};

